//
//  SetUpButton.swift
//  SimpleCal
//
//  Created by 杜晓祥 on 2021/10/22.
//

import Cocoa

class SetUpButton: BaseView {
    
    
    var imageView:NSImageView!
    
    var label:DULabel!
    
    convenience init() {
        self.init(frame: CGRect.zero)
    }

    override init(frame frameRect: NSRect) {
        super.init(frame: frameRect)
        initialize()
    }
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
        initialize()
    }
    
    private func initialize () {
        self.mouseDownStyle = getDownStyle()
        self.mouseEnteredStyle = getEnteredStyle()
        self.defaultStyle = ViewStyleUtil.dayDefaultStyle()
        imageView = NSImageView()
        imageView.frame = NSRect(x: 15, y: 8, width: 18, height: 18)
        imageView.image = NSImage(named: "setUpIcon")
        
        imageView.alphaValue = 0.7
        addSubview(imageView)
        label = DULabel()
        label.frame = NSRect(x: 33, y: 5, width: 87, height: 25)
        label.cell = VerticallyCenteredTextFieldCell()
        label.alignment = .left
        label.textColor = NSColor(red: 1, green: 1, blue: 1, alpha: 0.9)
        label.stringValue = "设置..."
        addSubview(label)
    }
    
    private func getDownStyle() -> ViewStyle {
        var s = ViewStyle()
        s.backgroundColor = CGColor(red: 255, green: 255, blue: 255, alpha: 0.4)
        s.borderColor = nil
        s.borderWidth = 0
        s.radius = 0
        return s
    }
    
    private func getEnteredStyle() -> ViewStyle {
        var s = ViewStyle()
        s.backgroundColor = CGColor(red: 255, green: 255, blue: 255, alpha: 0.2)
        s.borderColor = nil
        s.borderWidth = 0
        s.radius = 0
        return s
    }

    
}
